package com.neusoft.mapper;

import com.neusoft.domain.Food;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface FoodMapper {


    @Select("select count(*) from food where categoryId = #{categoryId}")
    Integer selectCountByCategoryId(Integer categoryId);


    List<Food> selectFoodByFoodName(@Param("foodName") String foodName,@Param("businessId") Integer businessId);

    @Insert("insert into food (categoryId, foodName, foodExplain, foodImg, foodPrice, businessId, remarks,status)" +
             " values (#{categoryId},#{foodName},#{foodExplain},#{foodImg},#{foodPrice},#{businessId},#{remarks},#{status})")
    void insert(Food food);

    @Update("update food set foodName = #{foodName} , categoryId = #{categoryId} , foodImg = #{foodImg}" +
            ",foodPrice = #{foodPrice},foodExplain = #{foodExplain} ,remarks = #{remarks},status = #{status} where foodId = #{foodId}")
    void update(Food food);
}
